<?php
/*
This file is part of CORPSLOG.

CORPSLOG is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

CORPSLOG is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with CORPSLOG. If not, see http://www.gnu.org/licenses/.
*/

// Prints conditional style sheet links for the blog head
function corpslog_stylesheets() {
	echo "\t" . '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('stylesheet_directory') . '/main.css" media="screen,projection" />' . "\n";
	echo "\t" . '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('stylesheet_directory') . '/print.css" media="print" />' . "\n";
}

// Adds CSS for the (random) banner image to the blog header, as set in the CORPSLOG theme options
function corpslog_banner_css() {
	// Get the image URIs for the banner image, as set in the theme options
	$header_images = get_option('corpslog_header_images');
	// Checks that there is at least one has been added to the image pool; if none, do not insert any CSS
	if ( count($header_images)>0 ) {
		echo "\t" . '<style type="text/css" media="screen,projection">' . "\n\t/*<![CDATA[*/\n";
		// Below you can change the HTML element to apply the CSS background descriptor
		printf( "\t\tdiv#wrapper div#access { background-image: url('%s'); }",
				$header_images[array_rand($header_images)] // Provides a random image URI from our image pool
			);
		echo "\n\t/*]]>*/\n\t</style>";
	}
}

// Adds the CORPSLOG random photos widget
function widget_corpslog_photos($args) {
	extract($args);
	// Saves title option for this widget
	$options = get_option('widget_corpslog_photos');
	$widget_photos = get_option('corpslog_widget_photo_uris');
	// If user has not provided own title for this widget, use the default title text
	$title = empty( $options['title'] ) ? __('Peace Corps Photos', 'corpslog') : $options['title'];
	$random_photo_keys = array_rand( $widget_photos, 6 );
?>
			<?php echo $before_widget . "\n"; ?>
				<?php echo $before_title . $title . $after_title; ?>
				<?php printf( '<div>%1$s %2$s %3$s %4$s %5$s %6$s</div>' . "\n",
						"\n\t\t\t\t\t" . $widget_photos[$random_photo_keys[0]], 
						"\n\t\t\t\t\t" . $widget_photos[$random_photo_keys[1]],
						"\n\t\t\t\t\t" . $widget_photos[$random_photo_keys[2]],
						"\n\t\t\t\t\t" . $widget_photos[$random_photo_keys[3]],
						"\n\t\t\t\t\t" . $widget_photos[$random_photo_keys[4]],
						"\n\t\t\t\t\t" . $widget_photos[$random_photo_keys[5]] . "\n\t\t\t\t"
					); ?>
			<?php echo $after_widget . "\n"; ?>
<?php
}

// Options panel for the CORPSLOG random photos widget
function widget_corpslog_photos_control() {
	$options = $newoptions = get_option('corpslog_widget_photos');
	if ( $_POST['widget_corpslog_photos_submit'] ) {
		$newoptions['title'] = strip_tags( stripslashes( $_POST['widget_corpslog_photos_title'] ) );
	}
	if ( $options != $newoptions ) {
		$options = $newoptions;
		update_option( 'widget_corpslog_photos', $options );
	}
	$title = attribute_escape( $options['title'] );
?>
			<p><label for="widget_corpslog_photos_title"><?php _e( 'Title:', 'corpslog' ) ?> <input id="widget_corpslog_photos_title" name="widget_corpslog_photos_title" type="text" value="<?php echo $title; ?>" class="widefat" /></label></p>
			<input type="hidden" id="widget_corpslog_photos_submit" name="widget_corpslog_photos_submit" value="1" />
<?php
}

// Initializes the CORPSLOG-specific widget
function corpslog_widgets_init() {
	// Do we even have widgets?
	if ( !function_exists('register_sidebars') )
		return;
	// Add descriptive text for the widget in WordPress 2.5
	$widget_details = array(
			'classname'    =>  'widget_corpslog_photos',
			'description'  =>  __( "Random Peace Corps Flickr images", "corpslog" )
		);
	// Register our widget
	wp_register_sidebar_widget( 'corpslog_photos', __( 'CorpsLog Photos', 'corpslog' ), 'widget_corpslog_photos', $widget_details );
	// Register our widget options panel
	wp_register_widget_control( 'corpslog_photos', __( 'CorpsLog Photos', 'corpslog' ), 'widget_corpslog_photos_control' );
}

// Adds the theme options submenu to the Presentation menu when theme is active
function corpslog_add_menu() {
	// Checks that user has an appropriate security level
	if ( !current_user_can('edit_themes') ) {
		die( __( 'ACCESS DENIED: Your don\'t have permission to do this.', 'corpslog' ) );
	// If yes, then add the CSS/JavaScript stuff to the dashboard header
	} elseif ( $_GET['page'] == basename(__FILE__) ) {
		add_action( 'admin_head', 'corpslog_admin_head' );
	}
	// Adds the theme options page to the Presentation menu
	add_theme_page( __( 'CorpsLog Theme Options', 'corpslog' ), __( 'Theme Options', 'corpslog' ), 'edit_themes', basename(__FILE__), 'corpslog_menu' );
}

if ( !function_exists('plaintxt_theme_donate') ) {
	function plaintxt_theme_donate() {
		$button = '
			<form id="paypal" method="post" action="https://www.paypal.com/cgi-bin/webscr" style="float:left;margin:0.9em 0.5em 0 0;">
				<div id="donate">
					<input name="cmd" type="hidden" value="_s-xclick" />
					<input name="submit" src="https://www.paypal.com/en_US/i/btn/x-click-but04.gif" type="image" alt="' . __( 'PayPal: The safer, easier way to donate!', 'scr' ) . '" />
					<img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="' . __( 'Donate with PayPal', 'scr' ) . '" width="1" height="1" border="0" />
					<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----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-----END PKCS7-----" />
				</div>
			</form>';
		echo $button . "\n";
	}
}

// Adds JavaScript and CSS to the CORPSLOG theme options submenu
function corpslog_admin_head() { ?>
<script type="text/javascript">
// <![CDATA[
	function previewImage(url) {
		var img = new Image();
		img.src=url;
		img.onload = function() {
			document.getElementById('previewImg').src = url;
			document.getElementById('previewImg').style.display = 'block';
		}
	}
// ]]>
</script>
<style type="text/css" media="screen,projection">
/*<![CDATA[*/
	div.wrap table tr img { max-width: 100%; }
	div.wrap table tbody tr img#previewImg { margin:0 auto; text-align: center; }
	div#license blockquote { color: #555555; }
	div#license blockquote strong { font-size: 85%; text-transform: uppercase; }
/*]]>*/
</style>
<?
}

// Produces the CORPSLOG  theme options submenu and saves options
function corpslog_menu() {
	// Clears any possible messages
	$message = null;
	// Get our image/photo options now!
	$header_images = get_option('corpslog_header_images');
	$widget_photos = get_option('corpslog_widget_photo_uris');
	// If we are saving an image URI, then . . .
	if ( isset( $_POST['header_image'] ) ) {
		// Check that the request came directly from the theme options page
		check_admin_referer('corpslog_add_header_images');
		// Check that there is a value to save; if not, produce an error message
		if ( $_POST['header_image'] == null ) {
			$message = __( '<div id="message" class="error fade-FF787C"><p><strong>Error:</strong> No image selected or invalid image <abbr title="Uniform Resource Identifier">URI</abbr>. Nothing done.</p></div>', 'corpslog' );
		// Otherwise, save the image URI(s) to the option
		} else {
			$header_images[] = $_POST['header_image'];
			update_option( 'corpslog_header_images', $header_images );
			$message = __( '<div id="message" class="updated fade"><p><strong>Success:</strong> Image added to header image pool.</p></div>', 'corpslog' );
		}
	} elseif ( isset( $_POST['widget_photo'] ) ) {
		if ( $_POST['widget_photo'] == null ) {
			$message = __( '<div id="message" class="error fade-FF787C"><p><strong>Error:</strong> Invalid photo <abbr title="Uniform Resource Identifier">URI</abbr>. Nothing done.</p></div>', 'corpslog' );
		} else {
			$widget_photos[] = str_replace( array( "\r", "\n", "\t" ), '', stripslashes( ($_POST['widget_photo']) ) );
			update_option( 'corpslog_widget_photo_uris', $widget_photos );
			$message = __( '<div id="message" class="updated fade"><p><strong>Success:</strong> Photo added to widget photo pool.</p></div>', 'corpslog' );
		}
	// If we are deleting an image from the image pool, then . . .
	} elseif ( isset( $_GET['delete_image'] ) ) {
		// Query the array of saved URIs, and delete the one we have requested
		if ( array_key_exists( $_GET['delete_image'], $header_images ) )
			unset( $header_images[$_GET['delete_image']] );
		update_option( 'corpslog_header_images', $header_images );
		$message = __( '<div id="message" class="updated fade"><p><strong>Success:</strong> Image removed from header image pool.</p></div>', 'corpslog' );
	} elseif ( isset( $_GET['delete_photo'] ) ) {
		// Query the array of saved URIs, and delete the one we have requested
		if ( array_key_exists( $_GET['delete_photo'], $widget_photos ) )
			unset( $widget_photos[$_GET['delete_photo']] );
		update_option( 'corpslog_widget_photo_uris', $widget_photos );
		$message = __( '<div id="message" class="updated fade"><p><strong>Success:</strong> Photo removed from widget photo pool.</p></div>', 'corpslog' );
	}
	// If we have a message after saving or deleting, then display it
	if ( $message != null )
		echo $message . "\n";

// Now let us make the theme options submenu
?>
<div id="corpslog-options" class="wrap">
	<h2><?php _e( 'CorpsLog Theme Options', 'corpslog' ) ?></h2>
	<?php if ( function_exists('plaintxt_theme_donate') ) plaintxt_theme_donate(); ?>
	<p><?php printf(
		__( 'You are using the CorpsLog theme template, version %1$s, by <span class="vcard"><a class="url fn n" href="%2$s" title="Scott Allan Wallick" rel="designer"><span class="given-name">Scott</span> <span class="additional-name">Allan</span> <span class="family-name">Wallick</span></a></span>. CorpsLog uses the rich semantic markup of the <a href="%3$s" title="Sandbox for WordPress">Sandbox</a> for its theme files. If you\'re using this theme, you should probably <a href="%4$s/wp-content/themes/corpslog/license.txt" title="View license">review its license</a>.', 'corpslog' ),
			'0.2.1', // Current CORPSLOG version
			'http://scottwallick.com/', // Our author's personal URI
			'http://www.plaintxt.org/themes/sandbox/', // The SANDBOX theme URI
			get_bloginfo('wpurl') // The directory of our WordPress installation
		); ?></p>
	<p style="clear:both;"><?php _e( 'The following options are available:', 'corpslog' ) ?></p>
	<ul id="menu">
		<li>
			<h3><?php _e( 'Header Image', 'corpslog' ) ?></h3>
			<ul>
				<li><?php _e( '<a href="#header-image" title="Manage images">Manage header image pool</a>', 'corpslog' ) ?></li>
				<li><?php _e( '<a href="#corpslog_add_header_images" title="Select images">Add images to the header image pool</a>', 'corpslog' ) ?></li>
			</ul>
		</li>
		<li>
			<h3><?php _e( 'Widget Photos', 'corpslog' ) ?></h3>
			<ul>
				<li><?php _e( '<a href="#manage-widget-photos" title="Manage images">Manage widget photo pool</a>', 'corpslog' ) ?></li>
				<li><?php _e( '<a href="#add-widget-photos" title="Select images">Add photos to the widget photo pool</a>', 'corpslog' ) ?></li>
			</ul>
		</li>
	</ul>
	<p style="clear:both;width:100%;">&nbsp;</p>
</div>
<div id="header-image" class="wrap">
	<h2><?php _e( 'Header Image', 'corpslog' ) ?></h2>
	<p><?php _e( 'If more than one image is present in the image pool, a random image will be used for the header background.', 'corpslog' ) ?></p>
	<table class="widefat" summary="<?php _e( 'Current header image pool', 'corpslog' ) ?>" width="100%">
		<thead>
			<tr>
				<th scope="col"><?php _e( 'Image', 'corpslog' ) ?></th>
				<th scope="col" width="100"><?php _e( 'Action', 'corpslog' ) ?></th>
			</tr>
		</thead>
		<tbody><?php
	// Let us find if we have any images saved in the theme options
	if ( $header_images == null || count($header_images)<1 ) {
		echo "\n\t\t\t\t<tr>\n\t\t\t\t\t" . '<td colspan="2" class="alternate">Header image pool empty</td>' . "\n\t\t\t\t</tr>\n";
	} else {
		// Since we have images, let us display them
		foreach ( $header_images as $key => $image ) {
			// To make our table pretty, let us add .alternate and then .alternate-alternate classes to each row
			$class = ( $key%2==0 ) ? '' : ' class="alternate"';
			printf(
				__( "\n\t\t\t\t" . '<tr valign="top"%1$s>' . "\n\t\t\t\t\t" . '<td><img src="%2$s" alt="Header image" /></td>' . "\n\t\t\t\t\t" . '<td><a href="?page=functions.php&amp;delete_image=%3$s" title="Remove this image from pool" onclick="return confirm(\'Click OK to remove image from header image pool. The image will not be deleted.\');" class="edit">Remove</a></td>' . "\n\t\t\t\t</tr>\n", 'corpslog' ),
					$class, // Here we provide our alternating classes
					$image, // Here we provide the image URI
					$key // Here we provide numeric ID for the image
				);
		}
	} ?>
		</tbody>
	</table>
	<form id="corpslog_add_header_images" name="corpslog_add_header_images" method="post" action="<?php echo wp_specialchars( $_SERVER['REQUEST_URI'] ) ?>#wphead">
		<?php wp_nonce_field('corpslog_add_header_images'); echo "\n"; ?>
		<h3><?php _e( 'Add Header Images', 'corpslog' ) ?></h3>
		<p><?php _e( 'Images in the <code>../corpslog/header/</code> folder may be added to the image pool. Accepted image formats are <code><abbr title="Joint Photographic Experts Group">JPG</abbr></code> and <code><abbr title="Portable Network Graphics">PNG</abbr></code>.', 'corpslog' ) ?></p>
		<table class="widefat" summary="<?php _e( 'Add images to pool', 'corpslog' ) ?>">
			<tbody>
				<tr>
					<th scope="row"><label for="header_image"><?php _e( 'Available Images:', 'corpslog' ) ?></label></th>
					<td>
						<select id="header_image" name="header_image" style="width:50%;" onchange="previewImage(this.options[this.selectedIndex].value);">
							<option value=""><?php _e( 'Select an image', 'corpslog' ) ?></option>
<?php	// First, let us define the server's absolute path to the /header/ subfolder in CORPSLOG
	$image_directory = @dir( ABSPATH . '/wp-content/themes/corpslog/header' );
		if ($image_directory) {
			// Second, let us define the URI to prefix any images we find in the folder
			$image_directory_uri = get_bloginfo('stylesheet_directory') . '/header';
			// Third, let us make sure we can, in fact, look inside that folder
			while ( ( $file = $image_directory->read() ) !== false ) {
				// We will limit our search to JPGs, JPEGs, or PNGs
				if ( preg_match( '/\w*(\.jpg|\.jpeg|\.png)$/', $file ) )
					// For each of JPG, JPEG, or PNG we find, produce an selectable OPTION element
					printf( "\t\t\t\t\t\t\t\t" . '<option value="%1$s/%2$s">%2$s</option>' . "\n",
						$image_directory_uri, // Here we provide the image URI prefix
						$file // Here we provide the file name found in the folder
					);
			}
		}
?>
						</select>
					</td>
				</tr>
				<tr valign="top">
					<td scope="row" class="preview" colspan="2">
						<img id="previewImg" src="<?php echo get_bloginfo('stylesheet_directory'); ?>/screenshot.png" alt="[Selected image preview]" style="display:none;" />
					</td>
				</tr>
			</tbody>
		</table>
		<p class="submit">
			<input name="update" type="submit" value="<?php _e( 'Add Header Image &raquo;', 'corpslog' ) ?>" />
			<input name="action" type="hidden" value="update" />
			<input name="page_options" type="hidden" value="header_image" />
		</p>
	</form>
	<p style="clear:both;width:100%;">&nbsp;</p>
</div><!-- #header-image -->
<div id="widget-photos" class="wrap">
	<h2><?php _e( 'Widget Photos', 'corpslog' ) ?></h2>
	<p><?php _e( 'Six photos are displayed randomly from the pool in the widget. If less than six photos are present, bad things will happen.', 'corpslog' ) ?></p>
	<fieldset id="manage-widget-photos" class="options" style="width:45%;float:left;">
		<legend><?php _e( 'Widget Photo Pool', 'corpslog' ) ?></legend>
		<table class="widefat" summary="<?php _e( 'Current widget photo pool', 'corpslog' ) ?>" width="45%">
			<thead>
				<tr>
					<th scope="col"><?php _e( 'Photo', 'corpslog' ) ?></th>
					<th scope="col" width="100"><?php _e( 'Action', 'corpslog' ) ?></th>
				</tr>
			</thead>
			<tbody><?php
		if ( $widget_photos == null || count($widget_photos)<1 ) {
			echo "\n\t\t\t\t<tr>\n\t\t\t\t\t" . '<td colspan="2" class="alternate">Widget photo pool empty</td>' . "\n\t\t\t\t</tr>\n";
		} else {
			foreach ( $widget_photos as $key => $photo ) {
				$class = ( $key%2==0 ) ? '' : ' class="alternate"';
				printf(
					__( "\n\t\t\t\t" . '<tr%1$s>' . "\n\t\t\t\t\t" . '<td>%2$s</td>' . "\n\t\t\t\t\t" . '<td><a href="?page=functions.php&amp;delete_photo=%3$s" title="Remove this photo from widget photo pool" class="delete" onclick="return confirm(\'Click OK to remove photo from widget photo pool.\');">Remove</a></td>' . "\n\t\t\t\t</tr>\n", 'corpslog' ),
						$class,
						$photo,
						$key
					);
			}
		} ?>
			</tbody>
		</table>
	</fieldset>
	<form id="corpslog_add_widget_photos" name="corpslog_add_widget_photos" method="post" action="<?php echo wp_specialchars( $_SERVER['REQUEST_URI'] ) ?>#wphead">
		<fieldset id="add-widget-photos" class="options" style="width:45%;float:right;">
			<legend><?php _e( 'Add Widget Photos', 'corpslog' ) ?></legend>
			<p><?php _e( 'Copy and paste the 75x75-sized photo <abbr title="Uniform Resource Locator">URIs</abbr> from <a href="http://www.flickr.com/" title="Flickr" rel="external">Flickr</a>, which will be an <code>IMG</code> wrapped in an <code>A</code> element. Line breaks, tabs, et cetera, will be stripped.', 'corpslog' ) ?></p>
			<table class="editform optiontable niceblue" cellpadding="5" cellspacing="2" summary="<?php _e( 'Add photos to widget photo pool', 'corpslog' ) ?>" width="100%">
				<tbody>
					<tr valign="top">
						<th scope="row"><label for="widget_photo"><?php _e( 'Flickr <abbr title="Uniform Resource Locator">URI</abbr>:', 'corpslog' ) ?></label></th>
						<td>
							<textarea id="widget_photo" name="widget_photo" style="width:95%;" rows="8" cols="50"></textarea>
						</td>
					</tr>
				</tbody>
			</table>
			<p class="submit">
				<input name="update" type="submit" value="<?php _e( 'Add Widget Photo &raquo;', 'corpslog' ) ?>" />
				<input name="action" type="hidden" value="update" />
				<input name="page_options" type="hidden" value="widget_photo" />
			</p>
		</fieldset>
	</form>
	<p style="clear:both;width:100%;">&nbsp;</p>
</div><!-- #widget-photos -->
<?
}

// Adds the function for conditional style sheet links to blog head
add_action( 'wp_head', 'corpslog_stylesheets', 1 );

// Adds the function for banner image CSS to the blog head
add_action( 'wp_head', 'corpslog_banner_css', 2 );

// Initializes CORPSLOG-specific widgets within WordPress
add_action( 'init', 'corpslog_widgets_init' );

// Initialize the CORPSLOG theme options menu after activating
add_action( 'admin_menu', 'corpslog_add_menu' );

// Loads localizations, if applicable (which it won't be)
load_theme_textdomain('corpslog');

// End CORPSLOG functions
?>